Skip to main content

Namespaces

A namespace is an isolated environment within your organization where compute resources, volumes, jobs, and secrets live. One user can belong to multiple namespaces; one namespace can have multiple users. All resource commands (compute, db, volume, job, secret) operate in whichever namespace is currently active.

List namespaces​

cgc namespace list

Shows every namespace you own or have been assigned to. The active namespace is marked with *.

cgc namespace list
name display name role
- -------------------- ----------------- ------
* ml-team-acme1234 ML Team rw
experiments-acme1234 Experiments ro
production-acme1234 Production exec

Switch active namespace​

cgc namespace use <name>

Sets the active namespace. CGC validates that you have access to the given namespace.

cgc namespace use ml-team-acme1234
Active namespace set to: ml-team-acme1234

Show active namespace​

cgc namespace current

cgc namespace current
ml-team-acme1234

Create a namespace​

cgc namespace create <name> [-d/--display <text>]

note

Only organization admins can create namespaces.

The name must be DNS-1123 compliant (lowercase letters, digits, hyphens). Your organization suffix is appended automatically.

  • -d, --display <text> - human-readable display name
cgc namespace create ml-team --display "ML Team"
Namespace ml-team-acme1234 created.

Assign a user to a namespace​

cgc namespace assign-user <name> <user> [-r/--role ro|rw|exec]

note

Only the namespace owner can assign users. The user must belong to the same organization.

  • <user> - the user's e-mail, or the user ID for accounts created before sign-in by e-mail
  • -r, --role ro|rw|exec - access role; if omitted, all three roles (ro, rw, exec) are granted
cgc namespace assign-user ml-team-acme1234 anna@acme.com --role rw
Assigned anna@acme.com (u-1a2b3c4d) to ml-team-acme1234 (roles: cgc-user-rw)

Remove a user from a namespace​

cgc namespace unassign-user <name> <user>

note

Only the namespace owner can remove users.

cgc namespace unassign-user ml-team-acme1234 anna@acme.com
Unassigned anna@acme.com (u-1a2b3c4d) from ml-team-acme1234

Invite a new user (org admin)​

cgc user create <email> -n <namespace>

note

Only an organization admin who owns the namespace can do this, and only for their own organization. The new user gets an e-mail from Keycloak with a link valid for 48 hours. Fails with EMAIL_TAKEN when the e-mail is already used.

Delete a namespace​

cgc namespace delete <name>

warning

Deletes the namespace and all resources inside it. This cannot be undone.

note

Only the namespace owner can delete a namespace.

cgc namespace delete experiments-acme1234
Namespace experiments-acme1234 and all its resources have been deleted.

Example flow​

Admin sets up a shared workspace and invites a user:

cgc namespace create ml-team --display "ML Team"
cgc namespace assign-user ml-team-acme1234 anna@acme.com

User starts working in the assigned namespace:

cgc namespace list
cgc namespace use ml-team-acme1234
cgc compute create -n my-notebook -c 4 -m 16 -g 1 nvidia-pytorch